import React, { Component } from 'react'
import { post, postReduce } from '../../../utils/axios'
import ACT from '../../actionType'
import { userReduce } from '../user.action'
@userReduce
export default class UserInfo extends Component {
  constructor(props) {
    super(props)
    console.log('props', props)
  }
  getData = async () => {
    let res = await post('/user', {})
    console.log('ress', res)
    let b = res.data
  }
  getData2 = () => this.props.dispatch(postReduce(ACT.USER_GET_SUCCESS, '/user'))
  render() {
    return (
      <div>
        <div>
          <p>用户信息es：{this.props.userInfo.keys}</p>
          <button onClick={() => this.getData()}>获取数据</button>
          <button onClick={() => this.getData2()}>获取数据</button>
        </div>
      </div>
    )
  }
}
